<template>
  <Dialog v-model="dialogVisible" :scroll="true" title="详情" :max-height="500" width="1000">
    <el-descriptions :column="1" :label-width="130" border>
      <el-descriptions-item label="社交平台" min-width="160">
        <dict-tag :options="common_social_type" :value="detailData.type" />
      </el-descriptions-item>
      <el-descriptions-item label="用户昵称" min-width="120">
        {{ detailData.nickname }}
      </el-descriptions-item>
      <el-descriptions-item label="用户头像" min-width="120">
        <el-image v-if="detailData.avatar" :src="detailData.avatar" class="h-30px w-30px" />
      </el-descriptions-item>
      <el-descriptions-item label="社交 token" min-width="120">
        {{ detailData.token }}
      </el-descriptions-item>
      <el-descriptions-item label="原始 Token 数据" min-width="120">
        <el-input
          v-model="detailData.rawTokenInfo"
          :autosize="{ maxRows: 20 }"
          :readonly="true"
          type="textarea"
        />
      </el-descriptions-item>
      <el-descriptions-item label="原始 User 数据" min-width="120">
        <el-input
          v-model="detailData.rawUserInfo"
          :autosize="{ maxRows: 20 }"
          :readonly="true"
          type="textarea"
        />
      </el-descriptions-item>
      <el-descriptions-item label="最后一次的认证 code" min-width="120">
        {{ detailData.code }}
      </el-descriptions-item>
      <el-descriptions-item label="最后一次的认证 state" min-width="120">
        {{ detailData.state }}
      </el-descriptions-item>
    </el-descriptions>
  </Dialog>
</template>

<script setup lang="ts">
import { SocialUserVO } from '@/api/system/social/social_user'

defineOptions({ name: 'SystemSocialUserDetail' })

const { common_social_type } = useIntDict(DICT_TYPE.common_social_type)

const dialogVisible = ref(false) // 弹窗的是否展示
const detailData = ref<SocialUserVO>({} as any) // 详情数据

/** 打开弹窗 */
const open = async (data: SocialUserVO) => {
  dialogVisible.value = true
  detailData.value = data
}
defineExpose({ open }) // 提供 open 方法，用于打开弹窗
</script>

<style scoped lang="scss"></style>
